package converter;

import java.util.Calendar;
import java.util.Date;

import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class DateToStringConverter implements Converter<Date, String> {

	@Override
	public String convert(Date date) {
		if(date!=null){
			Calendar cal = Calendar.getInstance();
			cal.setTime(date);
			return cal.get(Calendar.MONTH)+1 + "/" +  cal.get(Calendar.DATE) + "/" + cal.get(Calendar.YEAR); 
		}
		return null;
	}
}
